08/03/2024 02:00:46 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
   elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
   elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
   elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
   elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
     elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:75: <eof> expected near 'end'

08/03/2024 02:02:26 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
    end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:03:23 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:03:27 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:03:55 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and DestroyedUnit.type == "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:03:56 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and DestroyedUnit.type == "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:03:56 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and DestroyedUnit.type == "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:04:09 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and DestroyedUnit.type #= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: 'then' expected near '#'

08/03/2024 02:04:38 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:11:29 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and (DestroyedUnit.type ~= "Weapon") then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:11:30 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and (DestroyedUnit.type ~= "Weapon") then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:11:31 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and (DestroyedUnit.type ~= "Weapon") then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:11:49 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)" and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:11:50 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)" and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:11:59 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)" and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:12:00 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)" and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:12:48 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)" and DestroyedUnit.type ~= "Weapon") then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:12:50 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)" and DestroyedUnit.type ~= "Weapon") then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:12:51 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)" and DestroyedUnit.type ~= "Weapon") then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:15:38 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)" and DestroyedUnit.type ~= "Weapon") then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:15:40 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)" and DestroyedUnit.type ~= "Weapon") then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:15:41 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)" and DestroyedUnit.type ~= "Weapon") then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:31:29 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:31:30 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:32:22 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO Icebreaking") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:32:23 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO Icebreaking") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:32:25 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO Icebreaking") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:32:26 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO Icebreaking") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:32:26 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
    elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
    elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO Icebreaking") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:40:36 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
   elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
   elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
   elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
   elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
     elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end
ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:41:06 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
   elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
   elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
   elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
   elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
     elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
 
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end
ERROR:  [string "Console"]:123: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:41:59 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 1036 then -- F-16CG Blk 30 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 30 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
   elseif DestroyedUnit.dbid == 4708 then -- Airbus A.330-200 MRTT
        ScenEdit_SetScore("NATO", Score - 200, "Airbus A.330-200 MRTT Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
   elseif DestroyedUnit.dbid == 5436 then -- E-7A Wedgetail
        ScenEdit_SetScore("NATO", Score - 500, "E-7A Wedgetail Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5630 then -- MC-130J Commando II
        ScenEdit_SetScore("NATO", Score - 100, "MC-130J Commando II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
   elseif DestroyedUnit.dbid == 6901 then -- RQ-4B Global Hawk
        ScenEdit_SetScore("NATO", Score - 15, "RQ-4B Global Hawk")
   elseif DestroyedUnit.dbid == 5595 then -- MQ-9A Reaper Blk 5
        ScenEdit_SetScore("NATO", Score - 15, "MQ-9A Reaper Blk 5 Destroyed")
     elseif DestroyedUnit.dbid == 4328 then -- RQ-180
        ScenEdit_SetScore("NATO", Score - 35, "RQ-180 Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 6999  then -- MH-47G Chinook Blk II
        ScenEdit_SetScore("NATO", Score - 15, "MH-47G Chinook Blk II Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
   elseif DestroyedUnit.dbid == 5877 then -- RC-135S Cobra Ball
        ScenEdit_SetScore("NATO", Score - 250, "RC-135S Cobra Ball Joint Destroyed")
   elseif DestroyedUnit.dbid == 3318 then -- SR-72A Aurora
        ScenEdit_SetScore("NATO", Score - 350, "SR-72A Aurora Destroyed")
   elseif DestroyedUnit.dbid == 6619 then -- U-2S
        ScenEdit_SetScore("NATO", Score - 350, "U-2S Destroyed")
   elseif DestroyedUnit.dbid == 4883 then -- EA-37B Compass Call
        ScenEdit_SetScore("NATO", Score - 350, "EA-37B Compass Call Destroyed")
   elseif DestroyedUnit.dbid == 296 then -- CV-22A Osprey
        ScenEdit_SetScore("NATO", Score - 100, "CV-22A Osprey Destroyed")
   elseif DestroyedUnit.dbid == 5450 then -- B-2A Spirit
        ScenEdit_SetScore("NATO", Score - 800, "B-2A Spirit Destroyed")
 elseif DestroyedUnit.dbid == 6748 then -- B-21 Raider
        ScenEdit_SetScore("NATO", Score - 800, "B-21 Raider Destroyed")
 elseif DestroyedUnit.dbid == 6426 then -- B-1B Lancer
        ScenEdit_SetScore("NATO", Score - 800, "B-1B Lancer Destroyed")
 elseif DestroyedUnit.dbid == 6757 then -- B-52J Stratofortress
        ScenEdit_SetScore("NATO", Score - 800, "B-52J Stratofortress Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 4299 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 3885 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then -- AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur Destroyed")
 elseif DestroyedUnit.dbid == 3219 then -- Expeditionary Warfare USV
        ScenEdit_SetScore("NATO", Score - 200, "Expeditionary Warfare USV Destroyed")
elseif DestroyedUnit.dbid == 4354 then -- GARC-AAW [MADS]
        ScenEdit_SetScore("NATO", Score - 100, "GARC-AAW [MADS] Destroyed")
elseif DestroyedUnit.dbid == 3840 then -- GARC-IR
        ScenEdit_SetScore("NATO", Score - 100, "GARC-IR Destroyed")
elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 or DestroyedUnit.dbid == 668 or DestroyedUnit.dbid == 667 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
    elseif DestroyedUnit.dbid == 645 then -- Echo Voyager
        ScenEdit_SetScore("NATO", Score - 300, "Echo Voyager Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end
ERROR:  [string "Console"]:124: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:44:48 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 494 then -- F-16CG Blk 40 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 40 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 1194 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 2431 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then --AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:82: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:48:20 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 494 then -- F-16CG Blk 40 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 40 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 1194 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 2431 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then --AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)" and DestroyedUnit.type ~= "Weapon" then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:82: attempt to index a nil value (local 'DestroyedUnit')

08/03/2024 02:48:42 -- B1328.15 -- 
Console: 
--NATO losses script
local DestroyedUnit = ScenEdit_UnitX()
--ScenEdit_SpecialMessage('NATO', 'Script started')

local function AircraftDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 494 then -- F-16CG Blk 40 Falcon
        ScenEdit_SetScore("NATO", Score - 25, "F-16CG Blk 40 Falcon Destroyed")
    elseif DestroyedUnit.dbid == 6621 then -- KC-135R Stratotanker
        ScenEdit_SetScore("NATO", Score - 200, "KC-135R Stratotanker Destroyed")
    elseif DestroyedUnit.dbid == 4876 or DestroyedUnit.dbid == 3835 then -- F-35A Lightning II
        ScenEdit_SetScore("NATO", Score - 50, "F-35A Lightning II Destroyed")
    elseif DestroyedUnit.dbid == 4365 or DestroyedUnit.dbid == 4366 then -- HH-60G/W Credible Hawk
        ScenEdit_SetScore("NATO", Score - 15, "HH-60G Credible Hawk Destroyed")
    elseif DestroyedUnit.dbid == 4875 then -- F-22A Raptor
        ScenEdit_SetScore("NATO", Score - 50, "F-22A Raptor Destroyed")
    elseif DestroyedUnit.dbid == 5468 then -- C-17A Globemaster III
        ScenEdit_SetScore("NATO", Score - 150, "C-17A Globemaster III Destroyed") 
    elseif DestroyedUnit.dbid == 3853 then -- E-3G Sentry
        ScenEdit_SetScore("NATO", Score - 500, "E-3G Sentry Destroyed")
    elseif DestroyedUnit.dbid == 3215 then -- HC-130J Combat King II
        ScenEdit_SetScore("NATO", Score - 100, "HC-130J Combat King II Destroyed")
    elseif DestroyedUnit.dbid == 5759 then -- P-8A Poseidon
        ScenEdit_SetScore("NATO", Score - 250, "P-8A Poseidon Destroyed")
    elseif DestroyedUnit.dbid == 2846 then -- MQ-4C Triton
        ScenEdit_SetScore("NATO", Score - 15, "MQ-4C Triton Destroyed")
    elseif DestroyedUnit.dbid == 5338 or DestroyedUnit.dbid == 5037 then -- MH-60R Seahawk
        ScenEdit_SetScore("NATO", Score - 15, "MH-60R Seahawk Destroyed")
    elseif DestroyedUnit.dbid == 5614 then -- MH-65E Dolphin
        ScenEdit_SetScore("NATO", Score - 15, "MH-65E Dolphin Destroyed")
    elseif DestroyedUnit.dbid == 3458 then -- MQ-8B Fire Scout
        ScenEdit_SetScore("NATO", Score - 5, "MQ-8B Fire Scout Destroyed")
    elseif DestroyedUnit.dbid == 2779 then -- CH-148 Cyclone
        ScenEdit_SetScore("NATO", Score - 15, "CH-148 Cyclone Destroyed")
    elseif DestroyedUnit.dbid == 5676 then -- V-200
        ScenEdit_SetScore("NATO", Score - 2, "V-200 Destroyed")
    elseif DestroyedUnit.dbid == 4610 then -- CH-146 Griffon 
        ScenEdit_SetScore("NATO", Score - 15, "CH-146 Griffon Destroyed")
    elseif DestroyedUnit.dbid == 5833 then -- RC-135W Rivet Joint
        ScenEdit_SetScore("NATO", Score - 250, "RC-135W Rivet Joint Destroyed")
    end
end

local function ShipDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 4470 then -- Polar Star
        ScenEdit_SetScore("NATO", Score - 500, "Polar Star Destroyed")
    elseif DestroyedUnit.dbid == 3343 then -- Zumwalt
        ScenEdit_SetScore("NATO", Score - 1000, "Zumwalt Class Destroyed")
    elseif DestroyedUnit.dbid == 1194 or DestroyedUnit.dbid == 2718 then -- Burke
        ScenEdit_SetScore("NATO", Score - 750, "Arleigh Burke Class Destroyed")
    elseif DestroyedUnit.dbid == 2431 then -- Legend
        ScenEdit_SetScore("NATO", Score - 500, "Legend Class Destroyed")
    elseif DestroyedUnit.dbid == 3149 then -- Tico
        ScenEdit_SetScore("NATO", Score - 600, "Ticonderoga Class Destroyed")
    elseif DestroyedUnit.dbid == 2595 or DestroyedUnit.dbid == 4584 then -- LCS 2
        ScenEdit_SetScore("NATO", Score - 300, "LCS 2 Class Destroyed")
    elseif DestroyedUnit.dbid == 4472 then -- Terry Fox
        ScenEdit_SetScore("NATO", Score - 500, "Terry Fox Destroyed")
    elseif DestroyedUnit.dbid == 3569 then -- Halifax
        ScenEdit_SetScore("NATO", Score - 500, "Halifax Class Destroyed")
    elseif DestroyedUnit.dbid == 2797 then -- Harry DeWolf
        ScenEdit_SetScore("NATO", Score - 500, "Harry DeWolf Class Destroyed")
    elseif DestroyedUnit.dbid == 2315 or DestroyedUnit.dbid == 3127 or DestroyedUnit.dbid == 3444 or DestroyedUnit.dbid == 2381 then -- RHIB
        ScenEdit_SetScore("NATO", Score - 5, "RHIB Destroyed")
    elseif DestroyedUnit.dbid == 4455 then -- LRI
        ScenEdit_SetScore("NATO", Score - 10, "LRI Destroyed")
    elseif DestroyedUnit.dbid == 3645 then --AOR
        ScenEdit_SetScore("NATO", Score - 500, "AOR 520 Protecteur")
    end
end

local function SubDestroyed()
    local Score = ScenEdit_GetScore("NATO")
    if DestroyedUnit.dbid == 685 or DestroyedUnit.dbid == 554 then
        ScenEdit_SetScore("NATO", Score - 1000, "Submarine Destroyed")
    else 
        ScenEdit_SetScore("NATO", Score - 750, "Submarine Destroyed")
    end
end

if (DestroyedUnit.side == "NATO" or DestroyedUnit.side == "NATO (Icebreaking)") and (DestroyedUnit.type ~= "Weapon") then
    if DestroyedUnit.type == "Aircraft" then
        AircraftDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Aircraft')
    elseif DestroyedUnit.type == "Ship" then
        ShipDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Ship')
    elseif DestroyedUnit.type == "Submarine" then
        SubDestroyed()
        --ScenEdit_SpecialMessage('NATO', 'Sub')
    end
end

ERROR:  [string "Console"]:82: attempt to index a nil value (local 'DestroyedUnit')

